using System;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Windows;
using System.Windows.Controls;
using Cinch;
using SLS.Base;
using SLS.Controls;
using SLS.Document;
using SLS.ExClassLib.Data;
using SLS.ExClassLib.Events;
using SLS.ExClassLib.Loc;
using SLS.ExClassLib.Message;
using SLS.ExClassLib.MVVM;
using SLS.ExClassLib.WFActivities;
using SLS.WF.Activities;
namespace SLS.Presentation
{
    /// <summary>
    ////* 2012/10/6 18:18:51*/ 
    /// Interaction logic for EditGTKR.xaml
    /// </summary>
    [ViewnameToViewLookupKeyMetadata("EditGTKR", typeof(EditGTKR))]
    public partial class EditGTKR :  ExEDIT 
    {
        /*
        [Import("GTKRLocalizationModel", typeof(ILocalizationModel))]
        public override ILocalizationModel LocalizationModel
        {
            get { return base.LocalizationModel; }
            set { base.LocalizationModel = value; }
        }   
        */
        public EditGTKR()
        {
            InitializeComponent();
            #region Not In DesignMode
            if (DesignerProperties.GetIsInDesignMode(this as DependencyObject))
            {
                return;
            }
            #endregion  
            BaseTable = "GTKR";  
            Address = "EditGTKR" + "#" + Guid.NewGuid().ToString().ToUpper();    
            Address = "EditGTKR";    
            WFActivity = new WFEditGTKR(); 
            StartFedrate();
        }
        #region ---------------------WORKFLOW MESSAGE HANDLER---
        public override void ProcessWFMessage(MessageEx This_Message)
        {
            try
            {
                base.ProcessWFMessage(This_Message);
                string JobID = This_Message.JobID;
                string JobType = This_Message.JobType;
                string JobContent = This_Message.JobContent;
                switch (JobID)
                { 
                    case "OnThisFail":
                        UpdateByForeignKey(This_Message);
                        break; 
                    default:
                        if (JobID.Contains("OnCheck"))
                        {
                            ExDataRow row = new ExDataRow();
                            row.CheckForeignKey(This_Message);
                        }
                        break;

                }
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        } 
        #endregion

        #region ---------------------INTERNALS---------------------
        public override void SLBC_Loaded(object sender, RoutedEventArgs e)
        {
            base.SLBC_Loaded(sender, e);
            try
            {
                if (NMICD != null)
                {
                    NMICD.CMDEXE.TextChanged += new TextChangedEventHandler(CMDEXE_TextChanged);
                }
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }
      #endregion
    }
} 
 